/**
 *WangGANG
 *2018/10/22
 */
package main

import (
	"net"
	"tool"
	"time"
)

func main() {
	service := ":7777"
	tcpAdd,err := net.ResolveTCPAddr("tcp4",service)
	tool.ErrTest(err)
	listener,err := net.ListenTCP("tcp",tcpAdd)
	tool.ErrTest(err)
	for  {
		conn,err := listener.Accept()
		if err != nil{
			continue
		}
		go handleClient(conn)
	}
}

func handleClient(conn net.Conn){
	defer conn.Close()
	daytime := time.Now().String()
	conn.Write([]byte(daytime))
}